package com.hoshiicloud.common.utils;

import java.text.DecimalFormat;

/**
 * @Author:campchen
 * @Date:Created in 下午 06:34 2019/7/4
 * @PACKAGENAME com.hoshiicloud.common.utils.aesrsa
 * @Description
 */
public class DistanceUtil {
    public static String getDistanceByLongitudeAndLatitude(String longitudePerson, String latitudePerson, String longgitudeStore, String latitudeStore){
        Double Longitude=Double.parseDouble(longitudePerson)-Double.parseDouble(longgitudeStore);
        Double Latitude=Double.parseDouble(latitudePerson)-Double.parseDouble(latitudeStore);
        DecimalFormat format = new DecimalFormat("#");
        String distance = format.format(Math.sqrt(
                (Longitude*Longitude*111000*111000*Math.cos(Double.parseDouble(latitudeStore)*Math.cos(Double.parseDouble(latitudeStore))))+(Latitude*Latitude*111000 * 111000)
        ));
        return distance;
    }
}
